<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('books', function (Blueprint $table) {
            $table->id();
            $table->string('title')->comment('书名');
            $table->integer('selves_id')->comment('书架');
            $table->integer('category_id')->comment('分类');
            $table->string('author')->comment('作者');
            $table->string('publisher')->comment('出版社');
            $table->string('cover')->comment('封面');
            $table->integer('stock')->comment('库存');
            $table->decimal('star')->comment('星级');
            $table->integer('sort')->comment('排序');
            $table->integer('status')->comment('状态');
            $table->text('description')->comment('描述');
            $table->timestamps();
        });

        DB::statement("alter table books comment '图书'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('books');
    }
};
